﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GameBase.Form.Control;
using Microsoft.Xna.Framework;

namespace GalaxyPresident
{
    class SendingPanel:MyPanel
    {
        MyNumberBox numboxMaterial;
        MyNumberBox numboxEnergy;
        List<int> sendUnits = new List<int>();

        MyNumberBox numboxSpaceCraft;
        MyNumberBox numboxAirCraft;
        MyNumberBox numboxBomberCraft;

        public List<int> SendUnits
        {
            get { return sendUnits; }
        }

        public void Set(Planet planet)
        {
            numboxMaterial.Max = (int)planet.Meterial;
            numboxMaterial.Value = 0;
            numboxEnergy.Max = (int)planet.Energy;
            numboxEnergy.Value = 0;

            List<int> numbers = planet.GetNumberOfUnitPerType();            
            numboxSpaceCraft.Max = numbers[0];
            numboxAirCraft.Max = numbers[1];
            numboxBomberCraft.Max = numbers[2];
        }
       
        public SendingPanel(Vector2 position):base(@"Resources/Ingame/AdjustPanel",position)
        {
            Color FORCOLOR = GameScreen.FORCOLOR;
            Color PANEL_COLOR = GameScreen.PANEL_COLOR;
            Color BUTTON_COLOR = PlayingScreen.BUTTON_COLOR;
            Color CONTROL_COLOR = PlayingScreen.CONTROL_COLOR;
            Color = PANEL_COLOR;

            Add(new MyLabel(new Vector2(35,10),   "   MORTHER SHIP",FORCOLOR));
            Add(new MyLabel(new Vector2(35, 50), "==================", FORCOLOR));

            Add(new MyLabel(new Vector2(5, 100), "Material", FORCOLOR));
            numboxMaterial = new MyNumberBox(new Vector2(195, 100), 0, 500, 1, CONTROL_COLOR);
            Add(numboxMaterial);

            Add(new MyLabel(new Vector2(5, 150), "Energy", FORCOLOR));
            numboxEnergy = new MyNumberBox(new Vector2(195, 150), 0, 500, 1, CONTROL_COLOR);
            Add(numboxEnergy);

            Add(new MyLabel(new Vector2(5, 200), "SpaceCraft", FORCOLOR));
            numboxSpaceCraft = new MyNumberBox(new Vector2(195, 200), 0, 500, 1, CONTROL_COLOR);
            Add(numboxSpaceCraft);

            Add(new MyLabel(new Vector2(5, 250), "AirCraft", FORCOLOR));
            numboxAirCraft = new MyNumberBox(new Vector2(195, 250), 0, 500, 1, CONTROL_COLOR);
            Add(numboxAirCraft);

            Add(new MyLabel(new Vector2(5, 300), "BomberCraft", FORCOLOR));
            numboxBomberCraft = new MyNumberBox(new Vector2(195, 300), 0, 500, 1, CONTROL_COLOR);
            Add(numboxBomberCraft);

            for (int i = 0; i < 3; i++)
            {
                sendUnits.Add(0);
            }            
        }
        public SendingInfo GetInfo()
        {
            SendingInfo sendingInfo = new SendingInfo();
            sendingInfo.Enegry = numboxEnergy.Value;
            sendingInfo.Material = numboxMaterial.Value;

            List<int> listSendUnit = new List<int>();
            listSendUnit.Add(numboxSpaceCraft.Value);
            listSendUnit.Add(numboxAirCraft.Value);
            listSendUnit.Add(numboxBomberCraft.Value);
            sendingInfo.NumberOfUnits = listSendUnit;

            return sendingInfo;
        }
    }
}
